package buildcode.language.java.field;

import buildcode.database.TableColumnInfo;
import buildcode.language.MetaDataField;
import buildcode.language.Type;
import buildcode.language.java.type.JavaType;

public class JavaField extends MetaDataField<Type, TableColumnInfo> {

    public JavaField(String fieldName, String typeName, TableColumnInfo metaData) {
        super(fieldName, typeName, metaData);
    }

    public JavaField(String fieldName, Class<?> type, TableColumnInfo metaData) {
        this(fieldName, type, "", metaData);
    }

    public JavaField(String fieldName, Class<?> type, String note, TableColumnInfo metaData) {
        super(fieldName, type.getSimpleName(), metaData);
        setType(new JavaType(type.getSimpleName(), type.getPackage().getName()));
        setRemark(note);
    }

    public boolean isString() {
        return getTypeName().equals("String");
    }

}
